Ext.define('Imobil.store.Usuarios', {
    extend: 'Ext.data.Store',
    model:  'Usuario',
    autoLoad: false,
    remoteSort: false,
    pageSize: 5,
    
    proxy: {
        simpleSortMode: true,
        type: 'rest',
        url: '/api/usuario',   //http://imobil.localhost/api/usuario -> UsuarioController
        reader: {
            type: 'xml',
            root: 'data',
            record: 'result'
        },
        writer: {
            type: 'json',
            writeAllFields: true,
            encode: true,
            root: 'data'
        },
        
        listeners: {   // Listener do Proxy
            execption: function(proxy, response, operation){
                Ext.MessageBox.show({
                    title: 'Erro de Conexão',
                    msg: operation.getError,
                    icon: Ext.MessageBox.ERROR,
                    buttons: Ext.Msg.OK
                })
            }
        }
    },
    listeners: {  //Listener do Store
        write: function(proxy, operation){
            var obj;
        }
    }
});